home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / fontutil.6 / fontutil / fontutils-0.6 / include / pk.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-27  |  3.0 KB  |  95 lines

  1. /* pk.h: manipulate packed format font files.  See the PKtype source
  2.    code (by Tomas Rokicki), among other places, for the precise
  3.    definition of this bitmap format.
  4.  
  5. Copyright (C) 1992 Free Software Foundation, Inc.
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2, or (at your option)
  10. any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21. #ifndef PACKED_FONT_LIBRARY_H
  22. #define PACKED_FONT_LIBRARY_H
  23.  
  24. #include "bounding-box.h"
  25. #include "font.h"
  26. #include "types.h"
  27.  
  28.  
  29. /* Prepare and finish off FONT_NAME for reading.  */
  30. extern boolean pk_open_input_file (string font_name);
  31. extern void pk_close_input_file (string font_name);
  32.  
  33. /* The global information about the PK file is given in the preamble.  */
  34. typedef struct
  35. {
  36.   string comment;
  37.   fix_word design_size;
  38.   unsigned checksum;
  39.   double h_resolution, v_resolution;
  40. } pk_preamble_type;
  41.  
  42. /* This usually indicates the source of the PK file.  */
  43. #define PK_COMMENT(p)  ((p).comment)
  44.  
  45. /* The font's design size is in TeX points, expressed as a fix_word.  */
  46. #define PK_DESIGN_SIZE(p)  ((p).design_size)
  47.  
  48. /* The PK checksum should match the checksums in the TFM file and/or the
  49.    GF file, if they exist.  */
  50. #define PK_CHECKSUM(p)  ((p).checksum)
  51.  
  52. /* We express the resolutions in pixels per point multiplied by 2^16.  */
  53. #define PK_H_RESOLUTION(p)  ((p).h_resolution)
  54. #define PK_V_RESOLUTION(p)  ((p).v_resolution)
  55.  
  56. /* Return the above structure for the font FONT_NAME.  */
  57. extern pk_preamble_type pk_get_preamble (string font_name);
  58.  
  59.  
  60.  
  61. /* The characters comprise the bulk of the file.  */
  62. typedef struct
  63. {
  64.   one_byte code;
  65.   fix_word tfm_width;
  66.   signed_4_bytes h_escapement;
  67.   bounding_box_type bb;
  68.   bitmap_type bitmap;
  69. } pk_char_type;
  70.  
  71. /* The library guarantees that the character code is in the range 0 to
  72.    255 (although the PK format does not require that).  */
  73. #define PK_CHARCODE(c)  ((c).code)
  74.  
  75. /* The TFM width is the character's true width divided by the design
  76.    size (expressed as a fix_word).  */
  77. #define PK_TFM_WIDTH(c)  ((c).tfm_width)
  78.  
  79. /* The horizontal escapement (i.e., set width) is in pixels.  */
  80. #define PK_H_ESCAPEMENT(c)  ((c).h_escapement)
  81.  
  82. /* The bounding box is guaranteed to be the tightest possible.  */
  83. #define PK_CHAR_BB(c)  ((c).bb)
  84.  
  85. /* The bits themselves.  See `bitmap.h'.  */
  86. #define PK_BITMAP(c)  ((c).bitmap)
  87.  
  88.  
  89. /* Allocate and return a pointer to the above structure for the
  90.    character CODE in the font FONT_NAME, or NULL if that character is
  91.    not in that font.  */
  92. extern pk_char_type *pk_get_char (one_byte code, string font_name);
  93.  
  94. #endif /* not PACKED_FONT_LIBRARY_H */
  95.